<%= content_for(:page_title) do %>
  <%= Spree.t(:payment_methods) %>
<% end %>

<div class="table-responsive card-lg p-0 mb-4">
  <table class="table" id='listing_shipping_methods'>
    <thead class="text-muted">
      <tr>
        <th></th>
        <th><%= Spree.t(:payment_method) %></th>
        <th><%= Spree.t(:visibility) %></th>
        <th class="text-center"><%= Spree.t(:active) %></th>
        <th class="actions"></th>
      </tr>
    </thead>
    <tbody data-controller="sortable" data-sortable-handle-value=".move-handle" data-sortable-resource-name-value="payment_method" data-sortable-response-kind-value="turbo-stream">
      <%= render partial: 'spree/admin/payment_methods/payment_method', collection: @payment_methods %>
    </tbody>
  </table>
</div>

<% if available_payment_methods.present? %>
  <h5 class="pb-2 pt-3">Available Payment Methods</h5>
  <div class="table-responsive card-lg p-0">
    <table class="table" id='listing_shipping_methods'>
      <thead class="text-muted">
        <tr>
          <th><%= Spree.t(:name) %></th>
          <th><%= Spree.t(:description) %></th>
          <th class="actions"></th>
        </tr>
      </thead>
      <tbody>
        <%= render partial: 'spree/admin/payment_methods/available_payment_method', collection: available_payment_methods, as: :payment_method %>
      </tbody>
    </table>
  </div>
<% end %>

<% unless defined?(SpreeGateway) %>
  <div class="text-muted text-center p-5 d-flex align-items-center justify-content-center">
    More payment methods can be added by installing
    <%= external_link_to 'Spree Gateway gem', 'https://github.com/spree/spree_gateway', class: 'btn btn-link ml-1' %>
  </div>
<% end %>